/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author niit
 */
@Entity
@Table(name = "fl_student")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "FlStudent.findAll", query = "SELECT f FROM FlStudent f"),
    @NamedQuery(name = "FlStudent.findByStudentid", query = "SELECT f FROM FlStudent f WHERE f.studentid = :studentid"),
    @NamedQuery(name = "FlStudent.findByName", query = "SELECT f FROM FlStudent f WHERE f.name = :name"),
    @NamedQuery(name = "FlStudent.findByAddress", query = "SELECT f FROM FlStudent f WHERE f.address = :address"),
    @NamedQuery(name = "FlStudent.findByPhone", query = "SELECT f FROM FlStudent f WHERE f.phone = :phone")})
public class FlStudent implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "studentid")
    private Integer studentid;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 200)
    @Column(name = "name")
    private String name;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 500)
    @Column(name = "address")
    private String address;
    // @Pattern(regexp="^\\(?(\\d{3})\\)?[- ]?(\\d{3})[- ]?(\\d{4})$", message="Invalid phone/fax format, should be as xxx-xxx-xxxx")//if the field contains phone or fax number consider using this annotation to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "phone")
    private String phone;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "studentid")
    private List<FlQuery> flQueryList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "studentid")
    private List<FlFeedback> flFeedbackList;
    @JoinColumn(name = "courseid", referencedColumnName = "courseid")
    @ManyToOne(optional = false)
    private FlCourse courseid;
    @JoinColumn(name = "centerid", referencedColumnName = "centerid")
    @ManyToOne(optional = false)
    private FlStudycenter centerid;
    @JoinColumn(name = "memberid", referencedColumnName = "memberid")
    @ManyToOne(optional = false)
    private FlMember memberid;

    public FlStudent() {
    }

    public FlStudent(Integer studentid) {
        this.studentid = studentid;
    }

    public FlStudent(Integer studentid, String name, String address, String phone) {
        this.studentid = studentid;
        this.name = name;
        this.address = address;
        this.phone = phone;
    }

    public Integer getStudentid() {
        return studentid;
    }

    public void setStudentid(Integer studentid) {
        this.studentid = studentid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    @XmlTransient
    public List<FlQuery> getFlQueryList() {
        return flQueryList;
    }

    public void setFlQueryList(List<FlQuery> flQueryList) {
        this.flQueryList = flQueryList;
    }

    @XmlTransient
    public List<FlFeedback> getFlFeedbackList() {
        return flFeedbackList;
    }

    public void setFlFeedbackList(List<FlFeedback> flFeedbackList) {
        this.flFeedbackList = flFeedbackList;
    }

    public FlCourse getCourseid() {
        return courseid;
    }

    public void setCourseid(FlCourse courseid) {
        this.courseid = courseid;
    }

    public FlStudycenter getCenterid() {
        return centerid;
    }

    public void setCenterid(FlStudycenter centerid) {
        this.centerid = centerid;
    }

    public FlMember getMemberid() {
        return memberid;
    }

    public void setMemberid(FlMember memberid) {
        this.memberid = memberid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (studentid != null ? studentid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FlStudent)) {
            return false;
        }
        FlStudent other = (FlStudent) object;
        if ((this.studentid == null && other.studentid != null) || (this.studentid != null && !this.studentid.equals(other.studentid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.FlStudent[ studentid=" + studentid + " ]";
    }
    
}
